/**
 * fileName:  ArgumentBean.java
 * author:  Pitaya
 * Company:  Cloudland Studio
 * Createdate:  2014-6-7 上午12:38:44
 *
 * All rights Reserved, Designed By cloudland Copyright(C) 2010-2011
 *   
 * Modification  History:
 *     Date           Author        Version        
 * -------------------------------------------
 * 2014-6-7            Pitaya            1.0        
 *
 * Why & What is modified:
 * 1.0: 文件创建
 */
package org.cloudland.commercial.masterdata.handler.support;

import org.cloudland.commercial.masterdata.bean.ArgumentInfo;
import org.cloudland.commercial.masterdata.bean.RelationParam;
import org.cloudland.commercial.masterdata.store.entity.ArgumentEntity;
import org.cloudland.commercial.masterdata.store.write.ArgumentWriter;

 /**
 * <pre> 
 * TODO 水果参数领域实体
 * 使用 java.lang.Object#toString(), 或者 {@link java.lang.Character Character} 等标签
 * </pre>
 * @ClassName  ArgumentBean
 * @author  Pitaya
 * @version  %I%, %G%
 * @see  
 * @since   JDK1.6
 *
 */
public class ArgumentBean implements ArgumentInfo, RelationParam {
	
	private ArgumentEntity entity;

	private ArgumentWriter arguWriter;
	
	/**
	 * <pre>
	 * TODO 请充分描述该构造函数的作用，及其参数的作用。
	 * </pre>
	 *   
	 */
	public ArgumentBean(ArgumentWriter argWriter) {
		this(new ArgumentEntity(), argWriter);
	}
	
	

	public ArgumentBean(ArgumentEntity argumentEntity, ArgumentWriter argWriter) {
		this.entity = argumentEntity;
		this.arguWriter = argWriter;
	}



	/**
	 * @return
	 */
	public String getArgumentId() {
		return entity.getArgumentId();
	}

	/**
	 * @return
	 */
	public String getArgumentName() {
		return entity.getArgumentName();
	}

	/**
	 * @return
	 */
	public String getArgumentDesc() {
		return entity.getDescribtion();
	}

	/**
	 * @return
	 */
	public Integer getSort() {
		return entity.getSort();
	}

	/**
	 * @param paramName
	 */
	public void setArgumentName(String paramName) {
		entity.setArgumentName(paramName);
	}

	/**
	 * @param paramDesc
	 */
	public void setArgumentDesc(String paramDesc) {
		entity.setDescribtion(paramDesc);
	}

	/**
	 * @param sort
	 */
	public void setSort(Integer sort) {
		entity.setSort(sort);
	}

	/**
	 * 
	 */
	public void submit() {
		if(null != entity.getArgumentId() && entity.getArgumentId().length() > 0)
		{
			this.arguWriter.update(entity);
		}
		else
		{
			this.arguWriter.save(entity);
		}
	}

}
